package com.itheima.health.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.itheima.health.mapper.MemberMapper;
import com.itheima.health.pojo.Member;
import com.itheima.health.service.MemberService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService {

    //查询用户是否是会员
    @Override
    public Member findMemberByTelement(String telephone) {
        Member member = baseMapper.findMemberByTelement(telephone);
        return member;
    }

    //添加新会员
    @Override
    //开启事务管理
    @LcnTransaction
    public int saveMember(Member member) {
        baseMapper.insert(member);
        Integer mid = member.getId();
        return mid;
    }
}
